import {
  getnoticeList,
  getnoticeDetail
} from '@/services'
const state = {
  noticeList: {},
  noticeDetail: {}
};

const getters = {};

const mutations = {
  update(state, payload) {
    for (let key in payload) {
      state[key] = payload[key];
    }
  }
};

const actions = {
  async getnoticeList({ commit }) {
    let result = await getnoticeList();
    if (result) {
      commit('update', { noticeList: result });
    }
  },
  async getnoticeDetail({ commit }, payload) {
    let result = await getnoticeDetail(payload);
    if (result) {
      commit('update', { noticeDetail: result });
    }
  }
};

export default {
  namespaced: true,
  modules: {},
  state,
  getters,
  mutations,
  actions,
}
